<?php

/* @var $this yii\web\View */

$this->title = '智慧公厕';
?>
<div class="site-index">

    <div class="jumbotron">
        <!--<h1>Congratulations!</h1>-->

        <p class="lead">当前所有厕所状态</p>
        <div class="pull-right">
            <a href="index.php?r=toilet">编辑厕所名称</a>
        </div>
    </div>

    <div class="body-content">
        <?php for ($i=0; $i<count($rows);$i++){
            $this_url = 'index.php?r=current-toilet%2Fcharts&id=' . $rows[$i]['t_id'];
            if($i % 4 === 0 && $i!== 0){?>
        <div class="col-lg-10 div-w"></div><?php }?>
        <div class="col-lg-3">
            <div class="tolite-div list-group">

                <a href="<?=$this_url?>" class="list-group-item active">
                    <h4 class="list-group-item-heading">
                        <?=$rows[$i]['t']['cname']?>
                    </h4>
                </a>
                <a href="<?=$this_url?>" class="list-group-item">
                    <h4 class="list-group-item-heading">
                        使用情况
                    </h4>
                    <p class="list-group-item-text text-right">
                        <?=($rows[$i]['seats']-$rows[$i]['unuse'])?>/<?=$rows[$i]['seats']?>
                    </p>
                </a>
                <a href="<?=$this_url?>" class="list-group-item">
                    <h4 class="list-group-item-heading">
                        流量统计
                    </h4>
                    <p class="list-group-item-text text-right">
                        <?=$rows[$i]['flow']?>
                    </p>
                </a>
                <a href="<?=$this_url?>" class="list-group-item">
                    <h4 class="list-group-item-heading ">
                        温度
                    </h4>
                    <p class="list-group-item-text text-right">
                        <?=$rows[$i]['tem']?>
                    </p>
                </a>
                <a href="<?=$this_url?>" class="list-group-item">
                    <h4 class="list-group-item-heading">
                        湿度
                    </h4>
                    <p class="list-group-item-text text-right">
                        <?=$rows[$i]['hum']?>
                    </p>
                </a>
                <a href="<?=$this_url?>" class="list-group-item">
                    <h4 class="list-group-item-heading">
                        空气质量
                    </h4>
                    <p class="list-group-item-text text-right">
                        <?php if($rows[$i]['gas']===0){
                            echo "未知";
                        }elseif ($rows[$i]['gas']===1){
                            echo "优";
                        }elseif ($rows[$i]['gas']===2){
                            echo "良";
                        }elseif ($rows[$i]['gas']===3){
                            echo "差";
                        }
                        ?>
                    </p>
                </a>
                <a href="<?=$this_url?>" class="list-group-item">
                    <h4 class="list-group-item-heading">
                        更新时间
                    </h4>
                    <p class="list-group-item-text text-right">
                        <?=$rows[$i]['time']?>
                    </p>
                </a>
            </div>

        </div>

        <?php }?>
    </div>
</div>
